package com.gokzzz;

import com.gokzzz.entity.SysQuartzJob;
import com.gokzzz.quartz.QuartzManage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ganfujia
 * @date 2022/4/20 17:40
 */

@RestController
@RequestMapping("/test")
@Api(tags = "测试接口")
public class TestController {
    @Resource
    private QuartzManage quartzManage;

    @ApiOperation("add")
    @PostMapping("/add")
    public boolean add() {
        SysQuartzJob sysQuartzJob = new SysQuartzJob();
        sysQuartzJob.setId(1L);
        sysQuartzJob.setCronExpression("0/15 * * * * ?");
        sysQuartzJob.setBeanName("TestTask");
        sysQuartzJob.setMethodName("run1");
        sysQuartzJob.setParams("123");
        quartzManage.createScheduler(sysQuartzJob);
        return true;
    }


}
